<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: dylx
  Date: 2017/12/1
  Time: 15:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%

    System.out.println(request.getAttribute("list"));
%>
<html>
<head>
    <base href="${rootpath }"/>
    <title>客户关系管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="shortcut icon"  href="../images/favicon.ico" type="image/x-icon" />
    <link rel="bookmark" href="../images/favicon.ico" type="image/x-icon"/>

    <link rel="stylesheet" type="text/css" href="../js/easyui/main-layout.css"/>
    <link rel="stylesheet" type="text/css" href="../js/easyui/themes/default/easyui.css" id="swicth-style"/>
    <script type="text/javascript" src="../js/jquery-1.9.0.js"></script>
    <script type="text/javascript" src="../js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../js/easyui/easyui-messager.js"></script>

    <style type="text/css">
        .menu-bg,.top-bg,.welcome{
            background-color:#f6f5ec;
        }
    </style>

    <%--<%@ include file="main-js.jsp" %>--%>
    <script type="text/javascript">
        function addTab(title, url){
            if ($('#tabs').tabs('exists', title)){
                $('#tabs').tabs('select', title);//选中并刷新
                var currTab = $('#tabs').tabs('getSelected');
                //currTab.addClass("tabs-inner");
                var url = $(currTab.panel('options').content).attr('src');
                if(url != undefined && currTab.panel('options').title != 'Home') {
                    $('#tabs').tabs('update',{
                        tab:currTab,
                        options:{
                            content:createFrame(url)
                        }
                    });
                }
            } else { //标签页未打开时，添加新的标签页
                var content = createFrame(url);
                $('#tabs').tabs('add',{
                    title:title,
                    content:content,
                    closable:true
                });
            }
            tabClose(); //标签页上右键菜单
        }
        function createFrame(url) {
            var s = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';
            return s;
        }

        function tabClose() {
            /*双击关闭TAB选项卡*/
            $(".tabs-inner").dblclick(function(){
                //通过选项卡的标题找到要关闭tab页
                var subtitle = "<img src='images/msn.gif' style='vertical-align:middle'>"+$(this).children(".tabs-closable").text();
                $('#tabs').tabs('close',subtitle);
            });
            /*为选项卡绑定右键*/
            $(".tabs-inner").bind('contextmenu',function(e){
                $('#mm').menu('show', {
                    left: e.pageX,
                    top: e.pageY
                });
                var subtitle =$(this).children(".tabs-closable").text();
                $('#mm').data("currtab",subtitle);
                $('#tabs').tabs('select',subtitle);
                return false;
            });
        }

        //绑定右键菜单事件
        function tabCloseEven() {
            //刷新
            $('#mm-tabupdate').click(function(){
                var currTab = $('#tabs').tabs('getSelected');
                var url = $(currTab.panel('options').content).attr('src');
                if(url != undefined && currTab.panel('options').title != 'Home') {
                    $('#tabs').tabs('update',{
                        tab:currTab,
                        options:{
                            content:createFrame(url)
                        }
                    });
                }
            });
            //全部关闭
            $('#mm-tabcloseall').click(function(){
                $('.tabs-inner span').each(function(i,n){
                    var t = "<img src='images/msn.gif' style='vertical-align:middle'>"+$(n).text();
                    if(t != 'Home') {
                        $('#tabs').tabs('close',t);
                    }
                });
            });
            //关闭除当前之外的TAB
            $('#mm-tabcloseother').click(function(){
                var prevall = $('.tabs-selected').prevAll();
                var nextall = $('.tabs-selected').nextAll();
                if(prevall.length>0){
                    prevall.each(function(i,n){
                        var t="<img src='images/msn.gif' style='vertical-align:middle'>"+$('a:eq(0) span',$(n)).text();
                        if(t != 'Home') {
                            $('#tabs').tabs('close',t);
                        }
                    });
                }
                if(nextall.length>0) {
                    nextall.each(function(i,n){
                        var t="<img src='images/msn.gif' style='vertical-align:middle'>"+$('a:eq(0) span',$(n)).text();
                        if(t != 'Home') {
                            $('#tabs').tabs('close',t);
                        }
                    });
                }
                return false;
            });
        }

        $(function() {
            tabCloseEven();

            $('.cs-navi-tab').click(function() {
                var $this = $(this);
                var href = $this.attr('src');
                var title = "<img src='images/msn.gif' style='vertical-align:middle'>"+$this.text();
                addTab(title, href);
            });
            //切换菜单项前的图标
            $(".cs-navi-tab").hover(
                function(){
                    $(this).find("img").attr("src","images/ns_doc_mo.gif");
                },
                function(){
                    $(this).find("img").attr("src","images/ns_doc.gif");
                }
            );
        });


        function setCookie(name,value) {//两个参数，一个是cookie的名字，一个是值
            var Days = 30; //此 cookie 将被保存 30 天
            var exp = new Date();    //new Date("December 31, 9998");
            exp.setTime(exp.getTime() + Days*24*60*60*1000);
            document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
        }

        function getCookie(name) {//取cookies函数
            var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
            if(arr != null) return unescape(arr[2]); return null;
        }

        //退出该系统
        function logout(){
            $.messager.confirm('确认对话框', '您想要退出该系统吗？', function(r){
                if (r){ //退出操作;
                    //location.replace("url");
                }
            });
        }
    </script>

</head>

<body class="easyui-layout" >

<div region="north" border="true" class="cs-north">
    <div class="cs-north-bg top-bg">
        <div class="logo-title">客户关系管理系统</div>
        <div class="exit"><a href="javascript:logout()">退出系统</a></div>
    </div>
</div>
<div region="west" border="true" split="true" title="导航" class="cs-west">
    <div class="easyui-accordion" fit="true" border="false">
        <div title="客户管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="~cust/cust/list.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>客户信息管理</a></li>
                <li><a href="javascript:void(0);" src="~cust/lost/list.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>客户流失管理</a></li>
            </ul>
        </div>
        <div title="营销管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="~sale/list.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>销售机会管理</a></li>
                <li><a href="javascript:void(0);" src="~sale/dev.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>客户开发计划</a></li>
            </ul>
        </div>
        <div title="服务管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="~cust/service/add.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>服务创建</a></li>
                <li><a href="javascript:void(0);" src="~cust/service/dispatch.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>服务分配</a></li>
                <li><a href="javascript:void(0);" src="~cust/service/deal.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>服务处理</a></li>
                <li><a href="javascript:void(0);" src="~cust/service/feedback.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>服务反馈</a></li>
                <li><a href="javascript:void(0);" src="~cust/service/arch.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>服务归档</a></li>
            </ul>
        </div>
        <div title="统计报表" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="~rept/contr.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>客户贡献分析</a></li>
                <li><a href="javascript:void(0);" src="~rept/cons.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>客户构成分析</a></li>
                <li><a href="javascript:void(0);" src="~rept/ser.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>客户服务分析</a></li>
                <li><a href="javascript:void(0);" src="~rept/lost.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>客户流失分析</a></li>
            </ul>
        </div>
        <div title="数据字典管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="~basd/dict.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>数据字典</a></li>
            </ul>
        </div>
        <div title="用户管理" class="menu-bg">
            <ul>
                <li><a href="javascript:void(0);" src="demo/regist.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>验证参考示例1</a></li>
                <li><a href="javascript:void(0);" src="demo/regist2.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>验证参考示例2</a></li>
                <li><a href="javascript:void(0);" src="demo/calendar.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>eayui日历的使用</a></li>
                <li><a href="javascript:void(0);" src="demo/messager.html" class="cs-navi-tab"><img src="../images/ns_doc.gif"/>自定义eayui消息框</a></li>
            </ul>
        </div>
    </div>
</div>
<div id="mainPanle" region="center" border="true" border="false">
    <div id="tabs" class="easyui-tabs"  fit="true" border="false" >
        <div title="Home" class="welcome">
            <div class="cs-home-remark">
                <div class="page_title">数据字典管理</div>
                <div class="button_bar">
                    <button class="common_button" onclick="help('');">帮助</button>
                    <button class="common_button" ><a href="/Views/DictAddDy.jsp">新建</a></button>
                    <button class="common_button" onclick="reload();"><a href="test/selectByType">查询</a></button>
                </div>
                <a href="test/selectAll">查看信息</a>
                <table class="query_form_table">
                    <tr>
                        <th>类别</th>
                        <td><input name="in1" id="in1" value="<%=request.getParameter("in1")==null?"":request.getParameter("in1")%>" placeholder="请输入类别">"</td>
                        <th>条目</th>
                        <td><input name="in2" id="in2" value="<%=request.getParameter("in2")==null?"":request.getParameter("in2")%>" placeholder="请输入条目">"</td>
                        <th>值</th>
                        <td><input name="in3" id="in3" value="<%=request.getParameter("in3")==null?"":request.getParameter("in3")%>" placeholder="请输入值">"</td>
                    </tr>
                </table>
                <br />
                <div class="row clearfix">
                    <%--<div class="col-md-1 column">
                    </div>--%>
                    <div class="col-md-10 col-md-offset-1 column">
                        <div class="panel panel-primary">
                            <div class="panel-heading"><span class="glyphicon glyphicon-th-list"></span> 信息列表</div>
                            <div class="panel-body">
                                <table class="table table-striped table-hover">
                                    <thead>
                                    <tr>
                                        <th>编号</th>
                                        <th>类别</th>
                                        <th>条目</th>
                                        <th>值</th>
                                        <th>是否可编辑</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach var="li" items="${list}">
                                        <tr>
                                            <td class="list_data_number"><a href="test/selectByNo?dict_id=${li.dict_id}">${li.dict_id}</a></td>
                                            <td class="list_data_text">${li.dicttype}</td>
                                            <td class="list_data_text">${li.dictitem}</td>
                                            <td class="list_data_text">${li.dictvalue}</td>
                                            <td id="list_data_text">${li.dictiseditable}</td>
                                            <td>
                                                <%--<script>
                                                    function dy() {
                                                        document.getElementById("list_data_text")
                                                    }
                                                </script>--%>
                                            <a href="test/selectByNo" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#updateModal" data-backdrop="static"
                                            >
                                                <span class="glyphicon glyphicon-pencil"></span> 更新
                                            </a>&nbsp;
                                            <button class="btn btn-danger btn-xs" data-toggle="modal" data-target=".bs-example-modal-sm" data-backdrop="static"
                                            ">
                                            <span class="glyphicon glyphicon-trash"></span> <a href="test/deleteById?dict_id=${li.dict_id}">删除</a>
                                            </button>
                                            </td>
                                        </tr>
                                    </c:forEach>

                                    </tbody>


                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-1 column">
                    </div>
                </div>
            </div>

        </div>
        </div>
    </div>
</div><tr>
    <th colspan="6" class="pager">
        <div class="pager">
            共59条记录 每页<input value="10" size="2" />条
            第<input value="1" size="2"/>页/共5页
            <a href="#">第一页</a>
            <a href="#">上一页</a>
            <a href="#">下一页</a>
            <a href="#">最后一页</a>
            转到<input value="1" size="2" />页
            <button width="20" onclick="reload();">GO</button>
        </div>
    </th>
</tr>
<%--
	<div region="south" border="false" id="south"><center>@tianshaojie@foxmail.com</center></div>
--%>
<div id="mm" class="easyui-menu cs-tab-menu">
    <div id="mm-tabcloseother">关闭其他</div>
    <div id="mm-tabcloseall">关闭全部</div>
</div>

<%----%>

</body>
</html>
